efform_onload = function ()
{
	efgrid.submitInqu( "ef_grid_r", "ZM","ZMCS30","query");
	efgrid_onRowClicked("ef_grid_r",0);
//	$('#ef_region_detail').hide();
}; 
button_query_onclick = function () 
{   	
	efgrid.submitInqu( "ef_grid_r", "ZM","ZMCS30","query");
}
button_update_onclick = function (){ 
	if (isSelected("ef_grid_r") == 0)return; 
	efgrid.submitForm( "ef_grid_r", "ZM","ZMCS30","update",true);
}
button_insert_onclick = function (){
	if (isSelected("ef_grid_r") == 0)return; 
	efgrid.submitForm( "ef_grid_r", "ZM","ZMCS30","insert",true);
} 
button_delete_onclick = function (){
	var grid=isSelected("ef_grid_r");
	if (grid == 0)return; 
	var rows=grid.getCheckedRows();
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		if(r)efgrid.submitForm( "ef_grid_r", "ZM","ZMCS30","delete",true);
	});
}

efgrid_onRowClicked = function( grid_id, row_index ){
	if(grid_id == "ef_grid_r"){ 
	//	$('#ef_region_detail').show();
		var grid = efgrid.getGridObject(grid_id);
		var fdKeyId=grid.getCellValueByColumnName(row_index,"fdKeyId"); 
		$('#fdInitialDataId').val(fdKeyId); 
		efgrid.submitInqu( "ef_grid_d", "ZM","ZMCS31","query");
	}
}

/********************************************************************************
 ***********************************从表操作**************************************** 
 ********************************************************************************/
button_insert1_onclick = function (){
	if (isSelected("ef_grid_d") == 0)return; 
	efgrid.submitForm( "ef_grid_d", "ZM","ZMCS31","insert",true);
}
button_update1_onclick = function (){
	if (isSelected("ef_grid_d") == 0)return; 
	efgrid.submitForm( "ef_grid_d", "ZM","ZMCS31","update",true);
}
button_delete1_onclick = function (){
	var grid=isSelected("ef_grid_d");
	if (grid == 0)return;  
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		if(r){
			efgrid.submitForm( "ef_grid_d", "ZM","ZMCS31","delete",true);
		}
	}); 
}
button_modifystart_onclick = function (){
	if (isSelected("ef_grid_d") == 0)return; 
	efgrid.submitForm( "ef_grid_d", "ZM","ZMCS31","modifystart",true);
}
button_modifystop_onclick = function (){
	if (isSelected("ef_grid_d") == 0)return; 
	efgrid.submitForm( "ef_grid_d", "ZM","ZMCS31","modifystop",true);
}
var hideAndShowSubButtons=function(status)
{
	if(!status)
	{
		efbutton.setButtonStatus("insert1", false);
		efbutton.setButtonStatus("update1", false);
		efbutton.setButtonStatus("delete1", false);
	}else
	{
		efbutton.setButtonStatus("insert1", true);
		efbutton.setButtonStatus("update1", true);
		efbutton.setButtonStatus("delete1", true);
	}
}
efgrid_afterAddNewRow = function(grid_id){ 
	var grid = efgrid.getGridObject(grid_id);
	var rows = grid.getCheckedRows();
/*	if(grid_id=="ef_grid_d")
	{
		var fdInitialDataId=$('#fdInitialDataId').val();
		for(var i = 0 ; i < rows.length;i++){
			grid.setCellValue(rows[i],0,fdInitialDataId,TYPE_DATA); 
		}
	}*/
	if(grid_id=="ef_grid_r")
	{
		var fdCreator=$('#fdCreator').val();
		var fdCreatorId=$('#fdCreatorId').val();
		for(var i = 0 ; i < rows.length;i++){
			grid.setCellValue(rows[i],4,fdCreatorId,TYPE_DATA); 
		}
	}
}